<%@ page contentType="text/html; charset=UTF-8" language="java" errorPage="" %>
<%@page import="java.util.ResourceBundle"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>上传页面</title>
	<meta http-equiv="x-ua-compatible" content="ie=7" />
	<link href="<%=basePath%>style/txlz7.css" rel="stylesheet" type="text/css" id="txlz7"/>
	
	 <style>
			 td {
				font:12px/170% "宋体", "新宋体", "黑体"; color:#000
			}
			th {
				font:12px/170% "宋体", "新宋体", "黑体"; color:#000
			}
		.black_overlays{
			display: none;
			position: absolute;
			top: 0%;
			left: 0%;
			width: 100%;
			height: 100%;
			background-color: #C1EBFC;
			z-index:1002;
			-moz-opacity: 0.8;
			opacity:.80;
			filter: alpha(opacity=30);
		}
		
		.ErrorDiv {
			display: none;
			position: absolute;
			border: 1px solid #FFF;
			border-bottom:none;
			z-index:1003;
			overflow: auto;
		}
		
		.tree {
	display: none;
	position: absolute;
	top: 25%;
	left: 30%;
	width: 253px;
	height: 235px;
	border: 1px solid #11557B;
	border-bottom: block;
	background-color: #E2F7FF;
	z-index: 1003;
	overflow: auto;
}

.title {
	display: none;
	position: absolute;
	top: 21%;
	left: 30%;
	width: 255px;
	height: 205px;
	border: 0px solid #000;
	border-bottom: none;
	background-color: #E2F7FF;
	z-index: 1003;
	overflow: auto;
}

  .prog-border {
  height: 15px;
  width: 205px;
  background: #fff;
  border: 1px solid #000;
  margin: 0;
  padding: 0;
  }

  .prog-bar {
  height: 11px;
  margin: 2px;
  padding: 0px;
  background: #178399;
  font-size: 10pt;
  }
  
  .lan01{
background: url(<%=basePath%>images/lanbg01.gif) no-repeat 0 0; width:6px; height:24px;} 
.lan02{
background: url(<%=basePath%>images/lanbg02.gif) repeat-x; width:99%; height:24px;}            
.lan03{
background: url(<%=basePath%>images/lanbg03.gif) no-repeat; width:8px; height:24px;}             
.cha{
padding-top:3px}
	 </style>
	 <%
		String returnString = (String)request.getAttribute("returnString");
		ResourceBundle bundle = ResourceBundle.getBundle("com.tjsinfo.tjsoa.fileExpress.properties.FileExpress");
		String expressUserNum = bundle.getString("expressUserNum");
		String maxExpress = request.getParameter("maxExpress");
	 %>
	<link rel="stylesheet" type="text/css" href="<%=basePath%>ajaxFramework/ext-2.1/resources/css/ext-all.css" />
	<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
  	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/ext-all.js"></script>
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/source/locale/ext-lang-zh_CN.js"></script>   
	<script type="text/javascript" src="<%=basePath %>js/common/system/selectusertreecheck.js"></script>
	<script type='text/javascript' src="<%=basePath%>dwr/engine.js"></script>
	<script type='text/javascript' src="<%=basePath%>dwr/util.js"></script>
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/jQuery/jquery.js"></script>
		<script>
		var returnString = '<%=returnString %>';
	
	function closeErrorDiv(){
		document.getElementById("blackdiv").style.display = "none";
		document.getElementById("ErrorDiv").style.display = "none";
	}
	
	function xianshiErrorDiv(){
		document.getElementById("ErrorDiv").style.top = document.body.clientHeight/4;
		document.getElementById("ErrorDiv").style.left = document.body.clientWidth/8;
		document.getElementById("blackdiv").style.display = "block";
		document.getElementById("ErrorDiv").style.display = "block";
	}
	
	function xianshiErrorDiv2(){
		document.getElementById("ErrorDiv2").style.top = document.body.clientHeight/4;
		document.getElementById("ErrorDiv2").style.left = document.body.clientWidth/8;
		document.getElementById("blackdiv").style.display = "block";
		document.getElementById("ErrorDiv2").style.display = "block";
	}
	
	function submitform1(){
		var s = document.getElementById('express_userid');
		var a = s.value.toString();
		var user=a.split(',');
	  	var names=",";
	  	var ids=",";
	    if(s.value.length>0) {
	    	if(user.length ><%=expressUserNum %>){
	    		Ext.MessageBox.alert('提示框','<nobr>只支持最多<%=expressUserNum %>人同时发送！请重新选择接收人</nobr>');
	    	}else{
	    		document.form1.submit();
	    	}
	    }
	}
	
	function fuzhi(){
		var username = document.getElementById('express_username').value;
		if(username == null || username == ''|| username == ','){
			Ext.MessageBox.alert('提示框','<nobr>请选择接收的系统用户</nobr>');
			return;
		}
		var a = username.toString().substring(0,username.length-1);
		var user=a.split(',');
	    if(username.length>0) {
	    	if(user.length ><%=expressUserNum %>){
	    		Ext.MessageBox.alert('提示框','<nobr>只支持最多<%=expressUserNum %>人同时发送！请重新选择接收人</nobr>');
	    		return;
	    	}
	    }
		var str = document.form1.action;
		var userid = document.getElementById('express_userid').value;
		var jibie = document.getElementById('jibie').value;
		var beizhu = document.getElementById('beizhu').value;
		if(userid != null && userid != ''){
			str += '?userid='+userid;
		}
		if(jibie != null && jibie != ''){
			str += '&jibie='+jibie;
		}
		if(beizhu != null && beizhu != ''){
			if(beizhu.length>=221){
				Ext.MessageBox.alert('提示框','<nobr>备注最多为220字！</nobr>');
				return;
			}
			if(!/^[^\|"'<>]*$/.test(beizhu)){
  				Ext.MessageBox.alert('提示框',"<nobr>备注中不能含有<br/> 1 单引号: ' <br/> 2 双引号: \" <br/> 3 竖  杠: | <br/> 4 尖角号: < > <br/><br/>请检查输入！</nobr>");  
			 	return; 
  			}
			str += '&beizhu='+encodeURI(beizhu);
		}
		/**检查客户端是否存在上传文件
		var fso = new ActiveXObject("Scripting.FileSystemObject"); 
		var b = true;
		for(var j = 1;j<=5;j++){
			var a = document.getElementById('file'+j).value;
			if(a != '' && a != null){
			var fileName = fso.FileExists(a);
			if(!fileName){
				alert('请检查第'+j+'个文件上传路径是否正确！');
				b = false;
			}
			}
		}
		if(b){
			document.form1.action = str;
			document.form1.submit();
			showProgress();
		} 
		**/
		
		var b = false;
		for(var j = 1;j<=5;j++){
			var a = document.getElementById('file'+j).value;
			if(a != null && a != '')b=true;
		}
		if(b){
			document.form1.action = str;
			document.form1.submit();
			showProgress();
		}else{
			Ext.MessageBox.alert('提示框','<nobr>请选择上传文件</nobr>');
		}
	}
	
	window.onload = function(){
		initselectusertreecheck();
		document.getElementById("right").style.width = document.body.clientWidth-5;
		var tb = new Ext.Toolbar(
			{
				height:25
			}
		);
	
	    tb.render('menu');
		tb.add(
	    {
	            text:'确定',
	            iconCls: 'daohang',
	        	handler: function(){
	        		fuzhi();
				}
	    },
	    {
	            text:'返回',
	            iconCls: 'daohang',
	        	handler: function(){
	        		location.href="<%=basePath%>tjsinfo/tjsoa/fileExpress/loginFileExpress.do";
				}
	    }
	    );
		tb.addFill();
	    tb.addText('<img id="windowResize" src="<%=basePath%>images/m_icon05.gif;"><a style="font-weight:bold; color:black;line-height: 22px;">发送文件</a>&nbsp;&nbsp;&nbsp;');
	}
	</script>
</head>

<body>
<script type="text/javascript" src="fileUpload/env.js"></script>
<script type="text/javascript">
      Env.require("application/uploadProgress.js");
  </script>
  <div id="right" style="height: 100%;">
      <div id="menu" style="padding-top:4px;"></div>
      <div class="contact_content" style="height: 92%;">
         	  <div class="wjsdcontent" style="border-top:0px;">
         	  <form action="<%=basePath %>tjsinfo/tjsoa/fileExpress/upload.do" name="form1" method="post" enctype="multipart/form-data" onsubmit="fuzhi();">
         	  <input type="hidden" name="node2" id="node2"/>
         	  <input id="basePath" value="<%=basePath%>" type="hidden"/>
                  <table width="100%" border="0" cellspacing="0" >
                    <tr>
                      <td align="right">接收人:</td>
                      <td colspan="3"><input name="express_username" type="text"
										id="express_username" readonly="readonly" size="125"/>
					<input type="hidden" name="express_userid"
										id="express_userid" />
					<input type="button" value="选择接收人" onclick="selectusertreecheckwinshow('express_userid','express_username','node2')"/></td>
                    </tr>
                    <tr>
                      <td align="right" width="11%">级别:</td>
                      <td colspan="3">
                      	<select name="jibie" id="jibie">
              				<option value="0" selected="selected">普通</option>
              				<option value="1">加急</option>
              			</select>
                      </td>
                    </tr>
                    <tr>
                      <td align="right" width="11%">备注:<br/>(不得大于220字)</td>
                      <td colspan="3"><textarea name="beizhu" id="beizhu" cols="95" rows="10"></textarea></td>
                    </tr>
                    <tr>
                      <td align="right">添加文件:</td>
                      <td colspan="3">您每次可发送的文件总量(接受人×文件数量)大小为:<%=maxExpress %>M</td>
                    </tr>
                    <tr>
                      <td align="right" width="11%">文件列表:</td>
                      <td colspan="3"><input type="file" id="file1" name="file1" maxlength="100" size="35"/>
                      &nbsp;&nbsp;&nbsp;<input type="file" name="file2" id="file2" maxlength="100" size="35"/>
                      </td>
                    </tr>
                    <tr>
                      <td align="right" width="11%">&nbsp;</td>
                      <td colspan="3"><input type="file" name="file3" id="file3"maxlength="100" size="35"/>
                      &nbsp;&nbsp;&nbsp;<input type="file" name="file4" id="file4" maxlength="100" size="35"/></td>
                    </tr>
                    <tr>
                      <td align="right" width="11%">&nbsp;</td>
                      <td colspan="3"><input type="file" name="file5" id="file5" maxlength="100" size="35"/>
                      <div style="display: none"><input type="file" name="file6" maxlength="100" size="35"/></div>
                      </td>
                    </tr>
                  </table>
                  </form>
          	</div>
 			</div>          
  </div>

<div id="blackdiv" class="black_overlays">
	<iframe style="width:100%;height:100%;filter:alpha(opacity=0);-moz-opacity:0"></iframe>
</div>
</body>
</html>
